/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufpe.cin.plp.eseml.impl;

import br.ufpe.cin.plp.eseml.DependentVariables;
import br.ufpe.cin.plp.eseml.EsemlPackage;
import br.ufpe.cin.plp.eseml.IndependentVariables;
import br.ufpe.cin.plp.eseml.IndependentVariablesTreatments;
import br.ufpe.cin.plp.eseml.Variables;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Variables</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.VariablesImpl#getDependentVariables <em>Dependent Variables</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.VariablesImpl#getIndependentVariables <em>Independent Variables</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.VariablesImpl#getIndependentVariablesTreatments <em>Independent Variables Treatments</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class VariablesImpl extends MinimalEObjectImpl.Container implements Variables
{
  /**
   * The cached value of the '{@link #getDependentVariables() <em>Dependent Variables</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDependentVariables()
   * @generated
   * @ordered
   */
  protected DependentVariables dependentVariables;

  /**
   * The cached value of the '{@link #getIndependentVariables() <em>Independent Variables</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndependentVariables()
   * @generated
   * @ordered
   */
  protected IndependentVariables independentVariables;

  /**
   * The cached value of the '{@link #getIndependentVariablesTreatments() <em>Independent Variables Treatments</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndependentVariablesTreatments()
   * @generated
   * @ordered
   */
  protected IndependentVariablesTreatments independentVariablesTreatments;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected VariablesImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EsemlPackage.Literals.VARIABLES;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DependentVariables getDependentVariables()
  {
    return dependentVariables;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetDependentVariables(DependentVariables newDependentVariables, NotificationChain msgs)
  {
    DependentVariables oldDependentVariables = dependentVariables;
    dependentVariables = newDependentVariables;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__DEPENDENT_VARIABLES, oldDependentVariables, newDependentVariables);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDependentVariables(DependentVariables newDependentVariables)
  {
    if (newDependentVariables != dependentVariables)
    {
      NotificationChain msgs = null;
      if (dependentVariables != null)
        msgs = ((InternalEObject)dependentVariables).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__DEPENDENT_VARIABLES, null, msgs);
      if (newDependentVariables != null)
        msgs = ((InternalEObject)newDependentVariables).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__DEPENDENT_VARIABLES, null, msgs);
      msgs = basicSetDependentVariables(newDependentVariables, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__DEPENDENT_VARIABLES, newDependentVariables, newDependentVariables));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IndependentVariables getIndependentVariables()
  {
    return independentVariables;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetIndependentVariables(IndependentVariables newIndependentVariables, NotificationChain msgs)
  {
    IndependentVariables oldIndependentVariables = independentVariables;
    independentVariables = newIndependentVariables;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES, oldIndependentVariables, newIndependentVariables);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIndependentVariables(IndependentVariables newIndependentVariables)
  {
    if (newIndependentVariables != independentVariables)
    {
      NotificationChain msgs = null;
      if (independentVariables != null)
        msgs = ((InternalEObject)independentVariables).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES, null, msgs);
      if (newIndependentVariables != null)
        msgs = ((InternalEObject)newIndependentVariables).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES, null, msgs);
      msgs = basicSetIndependentVariables(newIndependentVariables, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES, newIndependentVariables, newIndependentVariables));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IndependentVariablesTreatments getIndependentVariablesTreatments()
  {
    return independentVariablesTreatments;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetIndependentVariablesTreatments(IndependentVariablesTreatments newIndependentVariablesTreatments, NotificationChain msgs)
  {
    IndependentVariablesTreatments oldIndependentVariablesTreatments = independentVariablesTreatments;
    independentVariablesTreatments = newIndependentVariablesTreatments;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS, oldIndependentVariablesTreatments, newIndependentVariablesTreatments);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIndependentVariablesTreatments(IndependentVariablesTreatments newIndependentVariablesTreatments)
  {
    if (newIndependentVariablesTreatments != independentVariablesTreatments)
    {
      NotificationChain msgs = null;
      if (independentVariablesTreatments != null)
        msgs = ((InternalEObject)independentVariablesTreatments).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS, null, msgs);
      if (newIndependentVariablesTreatments != null)
        msgs = ((InternalEObject)newIndependentVariablesTreatments).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS, null, msgs);
      msgs = basicSetIndependentVariablesTreatments(newIndependentVariablesTreatments, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS, newIndependentVariablesTreatments, newIndependentVariablesTreatments));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case EsemlPackage.VARIABLES__DEPENDENT_VARIABLES:
        return basicSetDependentVariables(null, msgs);
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES:
        return basicSetIndependentVariables(null, msgs);
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS:
        return basicSetIndependentVariablesTreatments(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EsemlPackage.VARIABLES__DEPENDENT_VARIABLES:
        return getDependentVariables();
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES:
        return getIndependentVariables();
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS:
        return getIndependentVariablesTreatments();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EsemlPackage.VARIABLES__DEPENDENT_VARIABLES:
        setDependentVariables((DependentVariables)newValue);
        return;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES:
        setIndependentVariables((IndependentVariables)newValue);
        return;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS:
        setIndependentVariablesTreatments((IndependentVariablesTreatments)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.VARIABLES__DEPENDENT_VARIABLES:
        setDependentVariables((DependentVariables)null);
        return;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES:
        setIndependentVariables((IndependentVariables)null);
        return;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS:
        setIndependentVariablesTreatments((IndependentVariablesTreatments)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.VARIABLES__DEPENDENT_VARIABLES:
        return dependentVariables != null;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES:
        return independentVariables != null;
      case EsemlPackage.VARIABLES__INDEPENDENT_VARIABLES_TREATMENTS:
        return independentVariablesTreatments != null;
    }
    return super.eIsSet(featureID);
  }

} //VariablesImpl
